package edu.kaist.cs408.pof.common.model;

import com.google.code.morphia.annotations.Entity;
import com.google.code.morphia.annotations.Id;
import com.google.code.morphia.annotations.Indexed;
import com.google.code.morphia.annotations.Reference;
import com.google.code.morphia.utils.IndexDirection;
import org.bson.types.ObjectId;

import java.util.LinkedList;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: duyleekun
 * Date: 5/8/12
 * Time: 8:24 PM
 * To change this template use File | Settings | File Templates.
 */

@Entity("Restaurant")
public class RestaurantVo implements Votable {
	@Id
	ObjectId mid;

	public ObjectId getMid() {
		return mid;
	}

	@Indexed(unique = true)
	String name;


	String phoneNumber;
	String emailAddress;
	String streetAddress;
	@Indexed(IndexDirection.GEO2D)
	protected double[] location = null;

	@Indexed(name = "openStatus")
	boolean openStatus;

	@Reference
	List<DishVo> dishes;

	int countReview;// implements Votable
	int totalReviewScore;// implements Votable


	public RestaurantVo(String name, String phoneNumber, String emailAddress, String streetAddress, double[] location) {
		this.name = name;
		this.phoneNumber = phoneNumber;
		this.emailAddress = emailAddress;
		this.streetAddress = streetAddress;
		this.location = location;
		openStatus = false;
		countReview = 0;
		totalReviewScore = 0;
		dishes = new LinkedList<DishVo>();
	}

	public RestaurantVo() {
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getPhoneNumber() {
		return phoneNumber;
	}

	public void setPhoneNumber(String phoneNumber) {
		this.phoneNumber = phoneNumber;
	}

	public String getEmailAddress() {
		return emailAddress;
	}

	public void setEmailAddress(String emailAddress) {
		this.emailAddress = emailAddress;
	}

	public String getStreetAddress() {
		return streetAddress;
	}

	public void setStreetAddress(String streetAddress) {
		this.streetAddress = streetAddress;
	}

	public double[] getLocation() {
		return location;
	}

	public void setLocation(double[] location) {
		this.location = location;
	}

	public boolean isOpenStatus() {
		return openStatus;
	}

	public void setOpenStatus(boolean openStatus) {
		this.openStatus = openStatus;
	}

	public List<DishVo> getDishes() {
		return dishes;
	}

	public void setDishes(List<DishVo> dishes) {
		this.dishes = dishes;
	}

	@Override
	public int getCountReview() {
		return countReview;
	}

	@Override
	public int getTotalReviewScore() {
		return totalReviewScore;
	}
}
